Load data
##specify variables
#for behavior information
completeFnames =list()
totalData = data.frame()
ic = 1;
#for demographic information
gender = data.frame()
age = data.frame()
ethnicity= data.frame()
race = data.frame()
subID = data.frame()
#for post survey
Postsurvey=data.frame()
Postsurvey_feature = data.frame()
prolificID = data.frame()
confirmationCode = data.frame()
PostsubID=data.frame()
##Getting data from online text output
for (ifiles in 1:length(SameDifferent_fnames)){
tempFile = read.table(paste0(dataPath,SameDifferent_fnames[ifiles]),header = F)
Trials = unlist(strsplit(as.character(tempFile$V1), ";"))
if (length(Trials)>10){
keyNum = data.frame()
accuracy = data.frame()
feature_index = data.frame()
RT = data.frame()
Fir_img = data.frame()
Sec_img = data.frame()
for (i in 1:length(Trials)){
temp = unlist(strsplit(Trials[i],","));
keyNum = rbind(keyNum,as.numeric(temp[2]))
accuracy = rbind(accuracy,as.numeric(temp[4]))
RT = rbind(RT,as.numeric(temp[5]))
feature_index = rbind(feature_index,as.numeric(temp[6]))
Fir_img = rbind(Fir_img,as.numeric(temp[7]))
Sec_img = rbind(Sec_img,as.numeric(temp[8]))
}
data = cbind(keyNum,accuracy,RT, feature_index,Fir_img,Sec_img)
colnames(data) = c("keys","accuracy", "rt","feature_index", "Fimg","Simg")
data = data[-1,]
data$subID = ifiles;
data$trialNum = 1:dim(data)[1];
totalData = rbind(totalData,data)
#Getting demo data
for (ifilesDe in 1:length(Demo_fnames)){
if (unlist(strsplit(SameDifferent_fnames[ifiles],"SameDifferent"))[2]==unlist(strsplit(Demo_fnames[ifilesDe],"demographics"))[2]){ tempDemoFile = read.table(paste0(dataPath,Demo_fnames[ifilesDe]),header = F)
Demo_info = unlist(strsplit(as.character(tempDemoFile$V1), ";"))
gender[ic,1] = unlist(Demo_info[1])
age[ic,1]=unlist(Demo_info[2])
ethnicity[ic,1]=unlist(Demo_info[3])
race[ic,1]=unlist(Demo_info[4])
subID[ic,1]=unlist(ifiles)
}# if
}#for
##Getting post-test data
for (ifilesDe in 1:length(Post_fnames)){
if (unlist(strsplit(SameDifferent_fnames[ifiles],"SameDifferent"))[2]==unlist(strsplit(Post_fnames[ifilesDe],"postsurvey"))[2]){ tempPostFile = read.table(paste0(dataPath,Post_fnames[ifilesDe]),header = F)
###separate feedback and prolific ID
if (dim(tempPostFile)[2]>1){
tempPostFile$y = apply( tempPostFile[,] , 1 , paste , collapse = "" )
Post_info = unlist(strsplit(as.character(tempPostFile$y), ";"))
}else{
Post_info = unlist(strsplit(as.character(tempPostFile$V1), ";"))
}
Postsurvey[ic,1]=unlist(Post_info[1])
prolificID[ic,1] = unlist(Post_info[2])
Postsurvey_feature[ic,1]=feature_index[2,]
confirmationCode[ic,1]=unlist(strsplit(SameDifferent_fnames[ifiles],"SameDifferent"))[2]
PostsubID[ic,1]=unlist(ifiles)
}#if
}#for
completeFnames[ic] =unlist(strsplit(SameDifferent_fnames[ifiles],"SameDifferent"))[2]
ic = ic+1;
}else{
}
}#for
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferent2WIXwiN7.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographics2WIXwiN7.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurvey2WIXwiN7.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferent56hTZNPT.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographics56hTZNPT.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurvey56hTZNPT.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferent6He39RiZ.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographics6He39RiZ.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurvey6He39RiZ.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferent77YGI5oG.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographics77YGI5oG.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurvey77YGI5oG.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferent7H7r0RUt.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographics7H7r0RUt.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurvey7H7r0RUt.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferent88gefOWo.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographics88gefOWo.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurvey88gefOWo.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferent8rKhL2CP.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographics8rKhL2CP.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurvey8rKhL2CP.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferent8wU9Sm36.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographics8wU9Sm36.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurvey8wU9Sm36.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferent9SbtkL13.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographics9SbtkL13.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurvey9SbtkL13.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferentaNxCzHBb.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicsaNxCzHBb.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveyaNxCzHBb.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferentaU1i98ft.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicsaU1i98ft.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveyaU1i98ft.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferentEbo8kYqx.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicsEbo8kYqx.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveyEbo8kYqx.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferenteNkRGgGI.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicseNkRGgGI.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveyeNkRGgGI.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferentFakaA2VB.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicsFakaA2VB.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveyFakaA2VB.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferentG04rS2Ht.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicsG04rS2Ht.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveyG04rS2Ht.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferentG2b3WHQK.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicsG2b3WHQK.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveyG2b3WHQK.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferentHmMA6n3T.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferentJlqecS7E.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicsJlqecS7E.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveyJlqecS7E.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferentJqodoe62.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicsJqodoe62.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveyJqodoe62.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferentjzeeTdmM.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicsjzeeTdmM.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveyjzeeTdmM.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferentK6DPAu2e.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicsK6DPAu2e.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveyK6DPAu2e.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferentMDQ48E1Q.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicsMDQ48E1Q.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveyMDQ48E1Q.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferentmm45XZhp.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicsmm45XZhp.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveymm45XZhp.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferentnwlTUAzj.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicsnwlTUAzj.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveynwlTUAzj.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferentOEmBOMas.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicsOEmBOMas.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveyOEmBOMas.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferentOl5UrvK5.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicsOl5UrvK5.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveyOl5UrvK5.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferentP3Lsy1mB.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicsP3Lsy1mB.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveyP3Lsy1mB.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferentQU54ovRe.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicsQU54ovRe.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveyQU54ovRe.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferentQVQoaMZD.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicsQVQoaMZD.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveyQVQoaMZD.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferentrfBTPv0i.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicsrfBTPv0i.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveyrfBTPv0i.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferentsBUKeuOA.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicssBUKeuOA.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveysBUKeuOA.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferentSGEdyx2i.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicsSGEdyx2i.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveySGEdyx2i.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferentT8NjfaZu.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicsT8NjfaZu.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveyT8NjfaZu.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferenttHySRFLY.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicstHySRFLY.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveytHySRFLY.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferenttSvMBx6g.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicstSvMBx6g.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveytSvMBx6g.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferenttu86BZnk.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicstu86BZnk.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveytu86BZnk.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferentvcwfTCXR.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicsvcwfTCXR.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveyvcwfTCXR.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferentVfrkc6xB.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicsVfrkc6xB.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveyVfrkc6xB.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferentWrSKqtpY.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicsWrSKqtpY.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveyWrSKqtpY.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferentXU4vvVBc.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicsXU4vvVBc.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveyXU4vvVBc.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV8_001/SameDifferentz1OtX885.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/demographicsz1OtX885.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV8_001/postsurveyz1OtX885.txt'
#demographic information
demographic_information = cbind(gender,age,ethnicity,race,subID)
colnames(demographic_information) = c("Gender","Age","Ethnicity","Race","SubID")
demographic_information$Age = as.numeric(demographic_information$Age)
#save post test survey
postsurvey = cbind(Postsurvey,Postsurvey_feature,prolificID,PostsubID,confirmationCode)
colnames(postsurvey) = c("post_surve","feature","prolificID","SubID","confirm_code")
#write.csv(postsurvey, file = paste0(postsurvey_new_fname,".csv"))
Behavior analysis
summarize = dplyr::summarize
basic = totalData %>% filter(keys>=0)%>% group_by(subID)%>% summarize(num_noresposnes = sum(keys==-1), num_same_resp = sum(keys==1), num_diff_resp = sum(keys==0), num_same_trials =sum(cond==1), num_diff_trials = sum(cond==0),
hit = sum(keys==1&cond==1),
fa= sum(keys==1&cond==0),
cr = sum(keys==0&cond==0),
miss = sum(keys==0&cond==1),
HitRate =sum(keys==1&cond==1)/sum(cond==1),
FARate = sum(keys==1&cond==0)/sum(cond==0),
CRRate = sum(keys==0&cond==0)/sum(cond==0),
MissRate = sum(keys==0&cond==1)/sum(cond==1),
d_p = qnorm(HitRate)-qnorm(FARate))
basic
## # A tibble: 40 x 15
## subID num_noresposnes num_same_resp num_diff_resp num_same_trials
## <int> <int> <int> <int> <int>
## 1 1 0 32 52 21
## 2 2 0 23 60 21
## 3 3 0 39 41 20
## 4 4 0 23 60 20
## 5 5 0 34 50 21
## 6 6 0 40 44 21
## 7 7 0 42 42 21
## 8 8 0 38 46 21
## 9 9 0 39 38 20
## 10 10 0 36 48 21
## # ... with 30 more rows, and 10 more variables: num_diff_trials <int>,
## # hit <int>, fa <int>, cr <int>, miss <int>, HitRate <dbl>,
## # FARate <dbl>, CRRate <dbl>, MissRate <dbl>, d_p <dbl>
#Plotting
basic_longform = gather(basic, response_type, number_resp, HitRate,FARate,CRRate,MissRate)
head(basic_longform)
## # A tibble: 6 x 13
## subID num_noresposnes num_same_resp num_diff_resp num_same_trials
## <int> <int> <int> <int> <int>
## 1 1 0 32 52 21
## 2 2 0 23 60 21
## 3 3 0 39 41 20
## 4 4 0 23 60 20
## 5 5 0 34 50 21
## 6 6 0 40 44 21
## # ... with 8 more variables: num_diff_trials <int>, hit <int>, fa <int>,
## # cr <int>, miss <int>, d_p <dbl>, response_type <chr>,
## # number_resp <dbl>
ggplot(basic_longform, aes(x = response_type, y = number_resp, color = response_type))+
geom_boxplot(fill = "white",lwd = 1)+
geom_jitter(width=0.2,alpha = 0.5)+
labs(title="Proportaion response type", x = "response type", y = "proportion")+
plotformat

#d-p
ggplot(basic, aes(x = subID, y = d_p, color = as.factor(subID)))+
geom_point(size=3)+
labs(title="d prime", x = "subject", y = "d prime")+
plotformat
## Warning: Removed 1 rows containing missing values (geom_point).

ggplot(basic,aes(d_p))+
geom_histogram()+
labs(title="d prime histogram", x = "d prime", y = "counts")+
plotformat
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 5 rows containing non-finite values (stat_bin).

check d-p for each feature
#Add d prime to post survey file
postsurvey_d_p = postsurvey
postsurvey_d_p = postsurvey_d_p%>%filter(SubID %in% remainSub)
postsurvey_d_p = cbind(postsurvey_d_p, "dataSubID" = basic$subID, "d_p"=basic$d_p)
ggplot(postsurvey_d_p,aes(x = feature,y = d_p, color = as.factor(feature)))+
geom_boxplot(fill = "white",lwd = 1)+
geom_point(alpha = 0.5, size = 3)+
plotformat
## Warning: Removed 5 rows containing non-finite values (stat_boxplot).
## Warning: Removed 1 rows containing missing values (geom_point).

#stats
temp = subset(postsurvey_d_p, !is.infinite(postsurvey_d_p$d_p))
summary(aov(d_p~SubID+feature, temp))
## Df Sum Sq Mean Sq F value Pr(>F)
## SubID 1 0.048 0.0483 0.083 0.775
## feature 1 1.667 1.6671 2.863 0.100
## Residuals 32 18.631 0.5822
## 1 observation deleted due to missingness
#save summary file
write.csv(postsurvey_d_p, file = paste0(postsurvey_new_fname,".csv"))
Remove subjects with low d-p
remain_dp = basic$subID[basic$d_p>d_p_thre]
sprintf("remove d prime lower than %f %i",d_p_thre, length(remain_dp))
## [1] "remove d prime lower than 0.500000 34"
totalData = totalData %>%filter(subID%in%remain_dp)
#check feature number
tempFeature = totalData %>% group_by(subID) %>%summarize(feature = feature_index[1])
sprintf("Feature 1: %i; Feature 2: %i; Feature 3: %i",sum(tempFeature$feature==1),sum(tempFeature$feature==2),sum(tempFeature$feature==3))
## [1] "Feature 1: 11; Feature 2: 12; Feature 3: 10"
##########
basicFeature = totalData %>% filter(keys>=0)%>% group_by(subID,feature_index)%>% summarize(num_noresposnes = sum(keys==-1), num_same_resp = sum(keys==1), num_diff_resp = sum(keys==0), num_same_trials =sum(cond==1), num_diff_trials = sum(cond==0),
hit = sum(keys==1&cond==1),
fa= sum(keys==1&cond==0),
cr = sum(keys==0&cond==0),
miss = sum(keys==0&cond==1),
HitRate =sum(keys==1&cond==1)/sum(cond==1),
FARate = sum(keys==1&cond==0)/sum(cond==0),
CRRate = sum(keys==0&cond==0)/sum(cond==0),
MissRate = sum(keys==0&cond==1)/sum(cond==1),
d_p = qnorm(HitRate)-qnorm(FARate))
basicFeature_longform = gather(basicFeature, response_type, number_resp, HitRate,FARate,CRRate,MissRate)
head(basicFeature_longform)
## # A tibble: 6 x 14
## # Groups: subID [6]
## subID feature_index num_noresposnes num_same_resp num_diff_resp
## <int> <dbl> <int> <int> <int>
## 1 1 1 0 32 52
## 2 2 2 0 23 60
## 3 3 1 0 39 41
## 4 4 3 0 23 60
## 5 6 1 0 40 44
## 6 7 2 0 42 42
## # ... with 9 more variables: num_same_trials <int>, num_diff_trials <int>,
## # hit <int>, fa <int>, cr <int>, miss <int>, d_p <dbl>,
## # response_type <chr>, number_resp <dbl>
ggplot(basicFeature_longform, aes(x = response_type, y = number_resp, color = response_type))+
geom_boxplot(fill = "white",lwd = 1)+
geom_jitter(width=0.2,alpha = 0.5)+
facet_wrap(~feature_index)+
labs(title="Proportaion response type by feature", x = "response type", y = "proportion")+
plotformat

ggplot(basicFeature, aes(x = subID, y = d_p, group = feature_index, color = as.factor(feature_index)))+
geom_point(size=3)+
plotformat

###########
basicLevel = totalData %>% filter(keys>=0)%>% group_by(subID,level_diff)%>% summarize(num_noresposnes = sum(keys==-1), num_same_resp = sum(keys==1), num_diff_resp = sum(keys==0), num_same_trials =sum(cond==1), num_diff_trials = sum(cond==0),
hit = sum(keys==1&cond==1),
fa= sum(keys==1&cond==0),
cr = sum(keys==0&cond==0),
miss = sum(keys==0&cond==1),
HitRate =sum(keys==1&cond==1)/sum(cond==1),
FARate = sum(keys==1&cond==0)/sum(cond==0),
CRRate = sum(keys==0&cond==0)/sum(cond==0),
MissRate = sum(keys==0&cond==1)/sum(cond==1),
d_p = qnorm(HitRate)-qnorm(FARate))
basicLevel_longform = gather(basicLevel, response_type, number_resp, HitRate,FARate,CRRate,MissRate)
head(basicLevel_longform)
## # A tibble: 6 x 14
## # Groups: subID [1]
## subID level_diff num_noresposnes num_same_resp num_diff_resp
## <int> <dbl> <int> <int> <int>
## 1 1 0 0 14 7
## 2 1 1 0 11 7
## 3 1 2 0 3 12
## 4 1 3 0 1 11
## 5 1 4 0 2 7
## 6 1 5 0 0 6
## # ... with 9 more variables: num_same_trials <int>, num_diff_trials <int>,
## # hit <int>, fa <int>, cr <int>, miss <int>, d_p <dbl>,
## # response_type <chr>, number_resp <dbl>
ggplot(basicLevel_longform, aes(x = response_type, y = number_resp, color = response_type))+
geom_boxplot(fill = "white",lwd = 1)+
geom_jitter(width=0.2,alpha = 0.5)+
facet_wrap(~level_diff,nrow = 1)+
labs(title="Proportaion response type by difficulty level", x = "response type", y = "proportion")+
theme_facet()
## Warning: Removed 462 rows containing non-finite values (stat_boxplot).
## Warning: Removed 462 rows containing missing values (geom_point).

###########
basicLevelFeature = totalData %>% filter(keys>=0)%>% group_by(subID,level_diff,feature_index)%>% summarize(num_noresposnes = sum(keys==-1), num_same_resp = sum(keys==1), num_diff_resp = sum(keys==0), num_same_trials =sum(cond==1), num_diff_trials = sum(cond==0),
hit = sum(keys==1&cond==1),
fa= sum(keys==1&cond==0),
cr = sum(keys==0&cond==0),
miss = sum(keys==0&cond==1),
HitRate =sum(keys==1&cond==1)/sum(cond==1),
FARate = sum(keys==1&cond==0)/sum(cond==0),
CRRate = sum(keys==0&cond==0)/sum(cond==0),
MissRate = sum(keys==0&cond==1)/sum(cond==1),
d_p = qnorm(HitRate)-qnorm(FARate))
basicLevelFeature_longform = gather(basicLevelFeature, response_type, number_resp, HitRate,FARate,CRRate,MissRate)
head(basicLevelFeature_longform)
## # A tibble: 6 x 15
## # Groups: subID, level_diff [6]
## subID level_diff feature_index num_noresposnes num_same_resp
## <int> <dbl> <dbl> <int> <int>
## 1 1 0 1 0 14
## 2 1 1 1 0 11
## 3 1 2 1 0 3
## 4 1 3 1 0 1
## 5 1 4 1 0 2
## 6 1 5 1 0 0
## # ... with 10 more variables: num_diff_resp <int>, num_same_trials <int>,
## # num_diff_trials <int>, hit <int>, fa <int>, cr <int>, miss <int>,
## # d_p <dbl>, response_type <chr>, number_resp <dbl>
ggplot(basicLevelFeature_longform, aes(x = response_type, y = number_resp, color = response_type))+
geom_boxplot(fill = "white",lwd = 1)+
geom_jitter(width=0.2,alpha = 0.5)+
facet_wrap(feature_index~level_diff,nrow = 3,strip.position = "bottom")+
labs(title="Proportaion response type by difficulty level", x = "level diff", y = "proportion")+
theme_facet()
## Warning: Removed 462 rows containing non-finite values (stat_boxplot).
## Warning: Removed 462 rows containing missing values (geom_point).
